package com.collection.linkedlist;

import java.util.LinkedList;

public class GetElementsLinkedListExample {
	public static void main(String[] args) {
		 
	    //create LinkedList object
	    LinkedList lList = new LinkedList();
	   
	    //add elements to LinkedList
	    lList.add("1");
	    lList.add("2");
	    lList.add("3");
	    lList.add("4");
	    lList.add("5");
	   
	    /*
	     * To get element at specified index from Java LinkedList, use
	     * Object get(int index) method.
	     *
	     * This method returns element at sepcified index from LinkedList.
	     */
	   
	    System.out.println("LinkedList contains : ");
	    for(int i=0; i< lList.size(); i++)
	    {
	      System.out.println(lList.get(i));
	    }
	  }
}
